package com.efast.dmom.mes.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.efast.dmom.mes.bean.ResultBean;
import com.efast.dmom.mes.bean.RouteLines;
import com.efast.dmom.mes.dao.entity.RouteLinesDao;
import com.efast.dmom.mes.service.RouteLinesService;

@Service
public class RouteLinesServiceImpl implements RouteLinesService {

	@Autowired
	private RouteLinesDao apsProductRouteLinesDao;
	
	@Override
	public ResultBean insertApsRouteLines(RouteLines apsRouteLines) {
		ResultBean resultBean = new ResultBean(true);
//		Map<String,Object> map = new HashMap<String,Object>();
//		map.put("routeId", apsRouteLines.getRouteId());
//		map.put("lineId", apsRouteLines.getLineId());
//		int addValidateRepetition = apsProductRouteLinesDao.addValidateRepetition(map);
//		if (addValidateRepetition >0 ) {
//			resultBean.setSuccess(false);
//			resultBean.setObject("当前工艺路径下此产线已经存在！");
//			return resultBean;
//		}
//		apsRouteLines.setCreationTime(TimeUtil.getLocalDateTime());
//		apsRouteLines.setCreator(SpringWebUtils.getRequestUser());
//		apsRouteLines.setCreationTimeZone(TimeUtil.getLocalTimeZone());
//		apsRouteLines.setLastModifiedTime(TimeUtil.getLocalDateTime());
//		apsRouteLines.setLastModifiedTimeZone(TimeUtil.getLocalTimeZone());
//		apsRouteLines.setLastModifier(SpringWebUtils.getRequestUser());
//		apsRouteLines.setCreationPid(1);
//		apsRouteLines.setDescription("21222222");
//		apsRouteLines.setRowStatus(12);
//		apsRouteLines.setRowTrxId(1l);
//		apsRouteLines.setSiteId(1);
//		apsProductRouteLinesDao.insertRouteLines(apsRouteLines);
		return resultBean;
	}

	@Override
	public ResultBean updateApsRouteLines(RouteLines apsRouteLines) {
		ResultBean resultBean = new ResultBean(true);
//		Map<String,Object> map = new HashMap<String,Object>();
//		map.put("routeId", apsRouteLines.getRouteId());
//		map.put("lineId", apsRouteLines.getLineId());
//		map.put("routeLinesId", apsRouteLines.getRouteLinesId());
//		int addValidateRepetition = apsProductRouteLinesDao.updateValidateRepetition(map);
//		if (addValidateRepetition >0 ) {
//			resultBean.setSuccess(false);
//			resultBean.setObject("当前工艺路径下此产线已经存在！");
//			return resultBean;
//		}
//		apsRouteLines.setUpdatefield("line_id = #{lineId},line_name = #{lineName},route_id = #{routeId}");
//		apsProductRouteLinesDao.updateRouteLines(apsRouteLines);
		return resultBean;
	}

	@Override
	public ResultBean deleteApsRouteLines(Long routeLinesId) {
		ResultBean resultBean = new ResultBean(true);
		apsProductRouteLinesDao.deleteRouteLines(routeLinesId);
		return resultBean;
	}

}
